#!/usr/bin/env bash
#
# useage="""
# Need a argues.
# useage: bash ${0} remote_host
# """
# if [ $# != 1 ];then
# 	echo "$useage"
# 	exit 2
# fi
RemoteHost=139.129.5.187
ProList=(
	24-walrus-live
	34-picasso-live
	44-cirrus-live
	54-roraima-live
	64-shasta-live
	74-frisian-live
	84-saltee-live
	94-meteora-live
)
ProPath=/alidata-1/hosts
SavePath=/home/log_bak

#save_path exists or not
if [ ! -d $SavePath ];then
	mkdir  $SavePath
fi

#connect remote & rsync files
cd $SavePath
for EachPro in ${ProList[*]};do
	if [ ! -d $EachPro ];then
		mkdir $EachPro
	fi
	rsync -avlr $RemoteHost:$ProPath/$EachPro/log/*.gz $EachPro
done